<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/5/8
 * Time: 下午2:04
 */

namespace App\Busi\Modules\Resource;


use App\Busi\Modules\BaseBusi;
use App\Exceptions\ErrorCode\UserError;
use App\Exceptions\UserException;
use App\Http\Requests\CompanyStaffDelRo;
use App\Models\CompanyStaff;


class CompanyStaffDelBusi extends BaseBusi
{
    public function handle(CompanyStaffDelRo $ro){
        $id = $ro->id;
        $where = [
            ['id','=',$id]
        ];
        $data = CompanyStaff::where($where)->first();
        if(!$data){
            throw new UserException(UserError::STAFF_NOT_EXSIT);
        }
        return $data->delete();

    }
}